﻿@model ProductModel
<script>
    $(document).ready(function() {
        $("#@Html.IdFor(model => model.IsShipEnabled)").click(toggleShipping);
        toggleShipping();
    });

    function toggleShipping() {
        if ($('#@Html.IdFor(model => model.IsShipEnabled)').is(':checked')) {
            $('#pnlFreeShipping').showElement();
            $('#pnlShipSeparately').showElement();
            $('#pnlAdditionalShippingCharge').showElement();
            $('#pnlWeight').showElement();
            $('#pnlLength').showElement();
            $('#pnlWidth').showElement();
            $('#pnlHeight').showElement();
            $('#pnlDeliveryDate').showElement();
        } else {
            $('#pnlFreeShipping').hideElement();
            $('#pnlShipSeparately').hideElement();
            $('#pnlAdditionalShippingCharge').hideElement();
            $('#pnlWeight').hideElement();
            $('#pnlLength').hideElement();
            $('#pnlWidth').hideElement();
            $('#pnlHeight').hideElement();
            $('#pnlDeliveryDate').hideElement();
        }
    }
</script>
<div class="card-body">
    <div id="product-shipping-area">
        <div class="form-group row">
            <div class="col-md-3">
                <nop-label asp-for="IsShipEnabled" />
            </div>
            <div class="col-md-9">
                <nop-editor asp-for="IsShipEnabled" />
                <span asp-validation-for="IsShipEnabled"></span>
            </div>
        </div>
        <nop-nested-setting asp-for="IsShipEnabled">
            <div class="form-group row @(Model.ProductEditorSettingsModel.Weight ? null : "advanced-setting")" id="pnlWeight">
                <div class="col-md-3">
                    <nop-label asp-for="Weight" />
                </div>
                <div class="col-md-9">
                    <nop-editor asp-for="Weight" asp-postfix="@Model.BaseWeightIn" />
                    <span asp-validation-for="Weight"></span>
                </div>
            </div>
            <div class="form-group row @(Model.ProductEditorSettingsModel.Dimensions ? null : "advanced-setting")" id="pnlLength">
                <div class="col-md-3">
                    <nop-label asp-for="Length" />
                </div>
                <div class="col-md-9">
                    <nop-editor asp-for="Length" asp-postfix="@Model.BaseDimensionIn" />
                    <span asp-validation-for="Length"></span>
                </div>
            </div>
            <div class="form-group row @(Model.ProductEditorSettingsModel.Dimensions ? null : "advanced-setting")" id="pnlWidth">
                <div class="col-md-3">
                    <nop-label asp-for="Width" />
                </div>
                <div class="col-md-9">
                    <nop-editor asp-for="Width" asp-postfix="@Model.BaseDimensionIn" />
                    <span asp-validation-for="Width"></span>
                </div>
            </div>
            <div class="form-group row @(Model.ProductEditorSettingsModel.Dimensions ? null : "advanced-setting")" id="pnlHeight">
                <div class="col-md-3">
                    <nop-label asp-for="Height" />
                </div>
                <div class="col-md-9">
                    <nop-editor asp-for="Height" asp-postfix="@Model.BaseDimensionIn" />
                    <span asp-validation-for="Height"></span>
                </div>
            </div>
            <div class="form-group row @(Model.ProductEditorSettingsModel.FreeShipping ? null : "advanced-setting")" id="pnlFreeShipping">
                <div class="col-md-3">
                    <nop-label asp-for="IsFreeShipping" />
                </div>
                <div class="col-md-9">
                    <nop-editor asp-for="IsFreeShipping" />
                    <span asp-validation-for="IsFreeShipping"></span>
                </div>
            </div>
            <div class="form-group row @(Model.ProductEditorSettingsModel.ShipSeparately ? null : "advanced-setting")" id="pnlShipSeparately">
                <div class="col-md-3">
                    <nop-label asp-for="ShipSeparately" />
                </div>
                <div class="col-md-9">
                    <nop-editor asp-for="ShipSeparately" />
                    <span asp-validation-for="ShipSeparately"></span>
                </div>
            </div>
            <div class="form-group row @(Model.ProductEditorSettingsModel.AdditionalShippingCharge ? null : "advanced-setting")" id="pnlAdditionalShippingCharge">
                <div class="col-md-3">
                    <nop-label asp-for="AdditionalShippingCharge" />
                </div>
                <div class="col-md-9">
                    <nop-editor asp-for="AdditionalShippingCharge" asp-postfix="@Model.PrimaryStoreCurrencyCode" />
                    <span asp-validation-for="AdditionalShippingCharge"></span>
                </div>
            </div>
            <div class="form-group row @(Model.ProductEditorSettingsModel.DeliveryDate ? null : "advanced-setting")" id="pnlDeliveryDate">
                <div class="col-md-3">
                    <nop-label asp-for="DeliveryDateId" />
                </div>
                <div class="col-md-9">
                    <nop-select asp-for="DeliveryDateId" asp-items="Model.AvailableDeliveryDates" />
                    <span asp-validation-for="DeliveryDateId"></span>
                </div>
            </div>
        </nop-nested-setting>
    </div>
</div>